#region Using Statements
using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using KLib.Physics.Collisions;
#endregion

namespace KLib.Physics
{
    public class BodyFactory
    {
        #region Fields

        #endregion

        #region Properties

        #endregion

        #region Initialization

        public BodyFactory()
        {

        }

        #endregion

        #region Methods

        #region CreateRectangleBody()
        public static RigidBody CreateRectangleBody(PhysicsManager physicsManager, float width, float height, float mass)
        {
            RigidBody body = CreateRectangleBody(width, height, mass);
            physicsManager.AddBody(body);
            return body;
        }

        public static RigidBody CreateRectangleBody(float width, float height, float mass)
        {
            RigidBody body = new RigidBody();
            body.Geometry.Add(new Geom(body,Vertices.CreateRectangle(width, height)));
            body.Mass = mass;
            body.MomentOfInertia = mass * (width * width + height * height) / 12f;
            return body;
        }
        #endregion

        #region CreateCircleBody()
        public static RigidBody CreateCircleBody(PhysicsManager physics, float radius, int edgeCount, float mass)
        {
            RigidBody body = CreateCircleBody(radius, edgeCount, mass);
            physics.AddBody(body);
            return body;
        }

        public static RigidBody CreateCircleBody(float radius, int edgeCount, float mass)
        {
            RigidBody body = new RigidBody();
            body.Geometry.Add(new Geom(body,Vertices.CreateCircle(radius, edgeCount)));
            body.Mass = mass;
            body.MomentOfInertia = 0.5f * mass * (float)Math.Pow(radius, 2);

            return body;
        }
        #endregion

        #endregion



        #region Helper Methods

        #endregion
    }
}
